package com.lx.thrift;

import org.apache.thrift.TException;
import thrift.generated.DataException;
import thrift.generated.Person;
import thrift.generated.PersonService;

public class PersonServiceImpl implements PersonService.Iface{

    /*
    * 通过将thrift文件生成代码
    * thrift --gen java src/thrift/data.thrift
    *
    * 思考如何通过 git subtree 实现rpc项目共享thrift代码和文件
    * */

    @Override
    public Person getPersonByUsername(String username) throws DataException, TException {
        System.out.println("got client param: " + username);

        Person person = new Person();
        person.setUsername(username);
        person.setAge(20);
        person.setMarried(false);

        return person;
    }

    @Override
    public void savePerson(Person person) throws DataException, TException {
        System.out.println("got client param: " + person);

        System.out.println(person.getUsername());


    }
}
